<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>部门查询</title>
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</head>
<body>
	<nav class="navbar navbar-default">
	  <div class="container-fluid">
	    <!-- Brand and toggle get grouped for better mobile display -->
	    <div class="navbar-header">
	      <a class="navbar-brand" href="#">耀耀员工管理系统</a>
	    </div>
	
	    <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      <ul class="nav navbar-nav navbar-right">
	        <li><a href="#">欢迎${requestScope.username }登陆~</a></li>
	        <li><a href="#">注销</a></li>
	      </ul>
	    </div><!-- /.navbar-collapse -->
	  </div><!-- /.container-fluid -->
	</nav>
	<div class="row">
	  <div class="col-md-3">
	    <%@include file="FunctionList.jsp" %>
	  </div>
	  <div class="col-md-9">
		<div class="panel panel-default">
		  <div class="panel-heading">部门查询</div>
		  <div class="panel-body">
		    
		    
		    <form class="form-horizontal" id="deptform" action="selectConditionDepartment" method="post">
		      <input type="hidden" name="curpage" value="1">
		      <%--通过隐藏表单域传递当前页curpage的值 --%>
			  <div class="form-group">
			    <label for="deptname" class="col-sm-2 control-label">部门名称</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="deptname" name="deptname" placeholder="请输入查询的部门名">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="deptinfo" class="col-sm-2 control-label">部门信息 </label>
			    <div class="col-sm-10">
			      <textarea class="form-control" rows="3" id="deptinfo" name="deptinfo" placeholder="请输入查询的部门描述"></textarea>
			    </div>
			  </div>
			  <div class="form-group">
			    <div class="col-md-5"></div>
			    <div class="col-md-2"><input type="submit" class="btn btn-primary btn-block" id="sbtn" value="查询"></div>
			    <div class="col-md-5"></div>
			  </div>
			</form>
		    
		    <table class="table table-hover">
		      <thead><tr>
		        <td>部门id</td>
		        <td>部门名称</td>
		        <td>部门信息</td>
		        <td>操作</td>
		      </tr></thead>
		      <tbody>
		        <c:forEach items="${requestScope.deptlist }" var="item">
		          <tr>
		            <td>${item.id}</td>
		            <td>${item.name}</td>
		            <td>${item.info}</td>
		            <td>
			      <a href="#" class="btn btn-warning" style="margin-right: 20px">更新</a>
			      <a href="#" class="btn btn-primary">删除</a></td>
		          </tr>
		        </c:forEach>
		      </tbody>
		    </table>
			
			
			<nav aria-label="Page navigation" style="text-align:center">
			  <ul class="pagination">
			    <c:choose>							
				  <c:when test="${requestScope.curpage==1}">
				  </c:when>
				  <c:otherwise>
				  <li><a href="selectConditionDepartment?curpage=${requestScope.curpage-1}&deptname=${requestScope.deptname}&deptinfo=${requestScope.deptinfo}" aria-label="Previous"> <span
						aria-hidden="true">&laquo;</span>
				   </a></li>
				  </c:otherwise>
				</c:choose>
				
				
				<c:forEach begin="1" end="${requestScope.pagesize }" step="1" var="item">
				  <c:choose>
				    <c:when test="item==${requestScope.curpage }">
					<li class="active mnavitem">${item}</li>
					</c:when>
					<c:otherwise>
					  <li class="mnavitem"><a href="selectConditionDepartment?curpage=${item}&deptname=${requestScope.deptname}&deptinfo=${requestScope.deptinfo}">${item}</a></li>
					</c:otherwise>
				  </c:choose>
				</c:forEach>
				
				
				<c:choose>
				  <c:when test="${requestScope.curpage==requestScope.pagesize}">
				  </c:when>
				  <c:otherwise>
					<li><a href="selectConditionDepartment?curpage=${requestScope.curpage+1}&deptname=${requestScope.deptname}&deptinfo=${requestScope.deptinfo}" aria-label="Next"> 
					  <span aria-hidden="true">&raquo;</span>
					</a></li>
				  </c:otherwise>
				</c:choose>
			  </ul>
			</nav>
		    
		    
		  </div>
		</div>	    
	  </div>
	</div>
</body>
</html>